package org.supper.user.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.supper.auth.utils.JsonResult;

@ControllerAdvice
public class TestException {
    /**
     * 用来处理该类型的异常
     * @param e
     * @return
     */
    @ResponseBody
    @ExceptionHandler(RuntimeException.class)
    public JsonResult handlerException(RuntimeException e){
        JsonResult jsonResult = new JsonResult();
        jsonResult.setMsg(e.getMessage());
        jsonResult.setCode("500");
        return jsonResult;
    }
}
